package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;

public class AppThreadLocalUtil {
    private static final ThreadLocal<ApUser> APP_USER_THREAD_LOCAL = new ThreadLocal<>();

    // 存入线程中
    public static void setUser(ApUser apUser){
        APP_USER_THREAD_LOCAL.set(apUser);
    }

    // 从线程取出
    public static ApUser getUser(){
        return APP_USER_THREAD_LOCAL.get();
    }

    // 清理线程
    public static void clear(){
        APP_USER_THREAD_LOCAL.remove();
    }
}
